package Coder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import messagePacket.Packet;

import org.msgpack.MessagePack;

import entity.ChatMessage;
 
public class ChatMsgEncoder extends MessageToByteEncoder<Packet> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception {
        byte[] msg = packet.encode();
        byteBuf.writeBytes(msg);
    }
}